//
//  AppGlobal.h
//  WisdomTS
//
//  Created by maruijin on 15/12/8.
//  Copyright © 2015年 shinow. All rights reserved.
//

#ifndef AppGlobal_h
#define AppGlobal_h



// 代理宏
#define APP_DELEGATE (AppDelegate*)[UIApplication sharedApplication].delegate
#define WTS_USER_DEFAULTS [NSUserDefaults standardUserDefaults]




#define HD_USER_DEFAULTS [NSUserDefaults standardUserDefaults]
#define HD_GUIDE_IS_LOOK @"HD_GUIDE_IS_LOOK" //是否展示了指导页
#define HD_LOGIN_IS_REMEMBER_PASSWORD @"HD_LOGIN_IS_REMEMBER_PASSWORD" //登录是否记住密码
#define HD_LOGIN_USERNAME       @"HD_LOGIN_USERNAME"
#define HD_USER_MODE        @"HD_USER_MODE"

#pragma mark- 颜色相关
#define IHEALTH_MAIN_SKIN_COLOR                         RGBCOLORV(0X0C098)            //主题颜色
#define IHEALTH_TABBAR_COLOR                            RGBCOLORV(0XF3F2F2)            //tabBar背景颜色
#define IHEALTH_NAVIGATION_TITLE_COLOR                  RGBCOLORV(0XFFFFFF)            //导航标题颜色
#define IHEALTH_VIEW_BACKGROUND_COLOR                   RGBCOLORV(0xF5F5F5)            //默认背景颜色
#define GREEN_COLOR                                     RGBCOLORV(0X0C098)            //绿色字体颜色
#define BLACK_COLOR                                     RGBCOLORV(0x333333)            //黑色字体颜色
#define GRY_COLOR                                       RGBCOLORV(0x808080)            //灰色字体颜色
#define ORANGE_COLOR                                    RGBCOLORV(0xf37300)          //橘黄色字体颜色

#define RED_COLOR_DARK                                  RGBCOLORV(0xD9021D)          //深红色色字体颜色
#define RED_COLOR                                       RGBCOLORV(0xD9021D)          //红色字体颜色
#define SEPARATOR_COLOR                                 RGBCOLORV(0XEFEFEF)          //分割线颜色
#define BORDER_COLOR_DARK                               RGBCOLORV(0xc9c9c9)          //边框颜色
#define LIGHTGARY_COLOR                                 RGBCOLORV(0xc9c9c9)          //边框颜色
#define TIMEBGVIEW_COLOR                                 RGBCOLORV(0xD7F7F1)          //时间轴背景颜色
#define BUTTON_COLOR                                 RGBCOLORV(0xEB4F38)          //按钮背景颜色红色
#define YELLOW_COLOR                                 RGBCOLORV(0xF3F3BC)          //黄色
//字体相关
#define APP_NAVIGATION_TITLE_FONTSIZE 18                                                //navigation的字体大小

#define FONT_SIZE_16  16
#define FONT_SIZE_14  16
#define FONT_SIZE_12  14
#define USHARE_DEMO_APPKEY @"5537029b67e58e0b0e0036a1"
#define FIRSTHTMLVERSION @"20180206"
/**
 *  设置颜色
 *
 *  @param rgbValue 十六进值
 *
 *  @return 颜色对象
 */

#define RGBCOLORV(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
       green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \
        blue:((float)(rgbValue & 0x0000FF))/255.0 \
       alpha:1.0]

#define RGBCOLORVA(rgbValue, alphaValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0x0000FF))/255.0 \
alpha:alphaValue]

#define kRandomColor [UIColor colorWithRed:arc4random()%256/255.0 green:arc4random()%256/255.0  blue:arc4random()%256/255.0 alpha:1]

#pragma mark -

#pragma mark - 默认控件的高度
#define TEXTFIELD_HEIGHT                    [[UIScreen mainScreen] bounds].size.height / 12 //登陆等界面输入框高度
#define APP_STATUSBAR_HEIGHT                20.0f
#define APP_NAVIGATIONBAR_HEIGHT            64.0f
#define APP_TABBAR_HEIGHT                   49.0f
#define HDSEGEMENTCONTROL_HEIGHT 40 //

#define INPUT_TELNUM_LENGTH                 11.0f   //用户手机号长度
#define INPUT_VERIFYNUM_LENGTH               6.0f   //验证码长度
#define INPUT_PASSWORD_LENGTH_MAX           20.0f   //密码最大长度
#define INPUT_PASSWORD_LENGTH_MIX            6.0f   //密码最小长度

#define APPScreenHeight [[UIScreen mainScreen] bounds].size.height
#define APPScreenWidth [[UIScreen mainScreen] bounds].size.width 
#define APPFrameWidth [UIScreen mainScreen].applicationFrame.size.width
#define APPFrameHeight [UIScreen mainScreen].applicationFrame.size.height


/**
 数据库路径
 */
#define COMMONSQLPATH [[NSBundle mainBundle]pathForResource:@"iosm_common" ofType:@"db"]
#define USERINFODBPATH [[NSBundle mainBundle]pathForResource:@"UserInfoDB" ofType:@"db"]//userInfodb文件路径

#define SQL_COMMONDB_VERSION  3


#ifdef DEVELOP
#define TLog(...) NSLog(@"%s 第%d行 \n %@\n\n",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])
#else
#define TLog(...)
#endif


#define DOCID [[HDUserMode alloc]initWithData:[HD_USER_DEFAULTS objectForKey:HD_USER_MODE] error:nil].docLogin.docId

/* iPhone 6Plus */
#define iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : 0)


/* iPhone 6 */
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : 0)

/* iPhone 5 */
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : 0)

/* iPhone 4 */
#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : 0)


#define WeakSelf(type)    __weak typeof(type) weak##type = type;
#define StrongSelf(type)  __strong typeof(type) strong##type = type;

#pragma mark - 通知
#define WTS_MESSAGE_BUTTON_NOTIFICATION  @"WTS_MESSAGE_BUTTON_NOTIFICATION"
#define WTS_EDIT_BUTTON_NOTIFICATION  @"WTS_EDIT_BUTTON_NOTIFICATION"

#pragma mark -
//字体相关
//px转换到pt
#define PXTOPTFONTSIZE(px)\
({\
 CGFloat pt = 0;\
 pt=px/2.0*APP_ADAPTATION.autoSizeScaleX;\
})



/**
 国际化
 */
#undef L
#define L(key) \
[[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]


#endif /* AppGlobal_h */
